package ar.com.ford.it.fullEconomics.facade;

import java.sql.Timestamp;
import java.util.Collection;
import ar.com.ford.it.fullEconomics.exception.FullEconomicsException;
import ar.com.ford.it.fullEconomics.logic.MixLogic;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas012VehicleVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesp01Part;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesp06Mix;
import ar.com.ford.it.fullEconomics.wslx.FullEconomicsWslxUser;

//****************************************************************
//* Copyright (c) 2004 Ford Motor Company. All Rights Reserved.
//*
//* $$Workfile:   MixFacade.java  $$
//* $$Revision:   1.3  $$
//* $$Author:   TMALDON4  $$
//* $$Date:   Apr 23 2009 08:02:54  $$
//*
//*****************************************************************
public class MixFacade {
    /**
     * Busca Economic Sources segun code y name
     * 
     * @param code
     * @param name
     * @return
     * @throws FullEconomicsException
     */
    public Collection<Teesp06Mix> findMix(Teesp01Part part,
    		Ncas012VehicleVw veiculoLine, Timestamp efecDate, String month)
            throws FullEconomicsException {
        MixLogic logic = new MixLogic();
        Collection<Teesp06Mix> ret = logic.findMix(part, veiculoLine, efecDate,
                month);
        return ret;
    }

    /**
     * Da de alta el Economic Source pasado por parametro
     * 
     * @param mix
     * Economic Source a dar de alta
     * @param user
     * Usuario que da de alta el Economic Source
     * @throws FullEconomicsException
     */
    public void createMix(Teesp06Mix mix, FullEconomicsWslxUser user)
            throws FullEconomicsException {
        MixLogic logic = new MixLogic();
        logic.createMix(mix, user);
    }

    /**
     * Actualiza el Economic Source pasado por parametro
     * 
     * @param mix
     * Mix a actualizar
     * @param user
     * Usuario que actualiza el Economic Source
     * @throws FullEconomicsException
     */
    public void updateMix(Teesp06Mix mix, FullEconomicsWslxUser user)
            throws FullEconomicsException {
        MixLogic logic = new MixLogic();
        logic.updateMix(mix, user);
    }

    /**
     * Elimina el mix pasado por parametro
     * 
     * @param mix
     * Mix a eliminar
     * @throws FullEconomicsException
     */
    public void deleteMix(Teesp06Mix mix) throws FullEconomicsException {
        MixLogic logic = new MixLogic();
        logic.deleteMix(mix);
    }

    /**
     * Determina si el mix pasado por parametro puede ser borrado. Esto lo
     * determina segun tenga o no referencia a el
     * 
     * @param mix
     * @return True si puede ser borrado. False en caso contrario
     * @throws FullEconomicsException
     */
    public void mixCanBeDeleted(Teesp06Mix mix) throws FullEconomicsException {
        MixLogic logic = new MixLogic();
        logic.deleteMix(mix);

    }

    /**
     * Obtiene el objeto segun la pk
     * 
     * @param part
     * @param plant
     * @param fechaEfectiva
     * @return
     * @throws FullEconomicsException
     */
    public Teesp06Mix getMixByPk(Teesp06Mix mix) throws FullEconomicsException {
        MixLogic logic = new MixLogic();
        Teesp06Mix ret = new Teesp06Mix();
        ret = logic.getMixById(mix);
        return ret;
    }
}
